<?php
    error_reporting(E_ALL & ~E_DEPRECATED);    
    require_once("condb.php");
    require_once("functions_sms_kute.php");  
                     
    $output = array();
    
    $info = isset($_GET["info"]) ? $_GET["info"] : "";
    if(empty($info)){
        $output["status"] = 5;
        $output["msg"] = "Invalid Request";
    } else {
        $info = urldecode(base64_decode($info));
        parse_str($info, $request);    
        
        $token = isset($request["token"]) ? cleanQuery($request["token"]) : "";
        if($token=="SmsKUteTAovieCAdmin@)!#"){
            
            $eventId = isset($request["eventId"]) ? intval($request["eventId"]) : "";
            if(empty($eventId)) {
                $sms = getSmsNew($eventId);    
                
                $contents = array();
                foreach($sms as $row){
                    $content["id"] = $row["id"]; 
                    $content["title"] = $row["title"]; 
                    $content["content"] = $row["content"];                 
                    $content["price"] = $row["price"];                 
                    
                    $contents[] = $content;
                }
                
                $output["status"] = 1;
                $output["msg"] = "Success Request";   
            } else {
                $output["status"] = 0;
                $output["msg"] = "Invalid Request";   
            }
        } else {
            $output["status"] = 4;
            $output["msg"] = "Sai token";    
        }
    }
    $output["sms"] = isset($contents) ? $contents : array();    
    
    echo json_encode($output);
?>